﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Willow.IRepository
{
    public interface IUnitOfWork : IDisposable
    {
        /// <summary>
        /// 从IOC容器中获取数据操作对象
        /// </summary>
        /// <typeparam name="TRepository">The type of the repository.</typeparam>
        /// <returns></returns>
        TRepository GetRepositoryFromIOC<TRepository>() where TRepository : class;
        /// <summary>
        /// 获取泛型数据操作对象
        /// </summary>
        /// <typeparam name="TEntity">The type of the entity.</typeparam>
        /// <returns></returns>
        IRepository<TEntity> GetStandardRepository<TEntity>() where TEntity : class;
        /// <summary>
        /// 执行存储过程
        /// </summary>
        /// <param name="procedureCommand">The procedure command.</param>
        /// <param name="sqlParams">The SQL parameters.</param>
        void ExecuteProcedure(string procedureCommand, params object[] sqlParams);
        /// <summary>
        /// 保存更改
        /// </summary>
        void SaveChanges();
    }
}
